import org.junit.*;
import static org.junit.Assert.*;
import com.thoughtworks.selenium.*;

import org.junit.Before;

public class CredoTest2 {

	Selenium testDriver;
	@Before
	public void setUp() throws Exception {
		testDriver = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.credomobile.com");
		testDriver.start();
	}
	
	@Test
	public void secondTestCase()
	{
		testDriver.open("/");
		testDriver.windowMaximize();
		testDriver.mouseOver("link=Phones");
		clickAndLoadNextPage("link=all phones");
		
		clickAndLoadNextPage("//div[@class='phoneInfo']/div[4]/a");
		
		testDriver.type("//div[@class='zipField']/input", "95134");
		clickAndLoadNextPage("//div[@class='zipField']/input[2]");
		
		
	    clickAndLoadNextPage("//DIV[@id='individualPlans']/TABLE/TBODY/TR[1]/TD[6]/A");
	    clickAndLoadNextPage("//DIV[@id='textMessagingPlans']/DIV[2]/DIV[2]/DIV/A");
	    testDriver.click("//DIV[@id='mainContentWrapper']/DIV[2]/DIV[2]/DIV[4]/FIELDSET[1]/DIV[1]/INPUT");
	    
	   // clickAndLoadNextPage("div[@class='credoForm']/fieldset[2]/div/input[2]");
	    testDriver.type("//div[@class='credoForm']/fieldset[2]/div/input[2]", "amit");
	    
	    
		
	}
	
	public void clickAndLoadNextPage(String page)
	{
		testDriver.click(page);
		testDriver.waitForPageToLoad("30000");
	}

	@After
	public void tearDown() throws Exception {
	//testDriver.close();
	}

}
